$(function(){
    ajaxTjZxt();
    ajaxTjBzt();
    ajaxTjHtml("");
});

var ajaxTjHtml = function(){
    var urlz = "/integral/examTj/examTjOneList";
    $.ajax({
        url : urlz,
        type : "get",
        dataType : "html",
        success : function(r) {
            $("#tjlb").html(r);
        }
    });
};


var ajaxTjZxt = function(){
    var urlz = "/integral/examTj/examTjOneZxtData";
    $.ajax({
        url : urlz,
        type : "get",
        dataType : "json",
        success : function(res) {
            var dom = document.getElementById("zxt");
            var myChart = echarts.init(dom);
            var option = {
                tooltip: {
                    trigger: 'axis'
                },
                xAxis: {
                    name:"月份",
                    type: 'category',
                    data: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
                },
                yAxis: {
                    name:"学习人数",
                    type: 'value'
                },
                series: [{
                    name:'学习人数',
                    data: res.listObject,
                    type: 'line',
                    symbolSize: 5,
                    lineStyle: {
                        normal: {
                            color: 'green',
                            width: 4,
                            type: 'dashed'
                        }
                    },
                    itemStyle: {
                        normal: {
                            borderWidth: 3
                        },

                    }
                }]
            };
            if (option && typeof option === "object") {
                myChart.setOption(option, true);
            }
        }
    });
};


var ajaxTjBzt = function(){
    var urlz = "/integral/examTj/examTjOneBztData";
    $.ajax({
        url : urlz,
        type : "get",
        dataType : "json",
        success : function(res) {
            var dom = document.getElementById("bzt");
            var myChart = echarts.init(dom);
            var option = {
                    title: {
                        text: '本月学习统计',
                        x: 'left'
                    },
                    tooltip: {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
                    legend: {
                        type: 'scroll',
                        orient: 'vertical',
                        right: 10,
                        top: 20,
                        bottom: 20,
                        data: ["已学习人数","未学习人数"]
                    },
                    series: [
                        {
                            type: 'pie',
                            radius: '60%',
                            center: ['40%', '50%'],
                            data: res.listData,
                            itemStyle: {
                                emphasis: {
                                    shadowBlur: 10,
                                    shadowOffsetX: 0,
                                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                                }
                            }
                        }
                    ]
                };
                if (option && typeof option === "object") {
                    myChart.setOption(option, true);
                }
            }
        });
};
